package com.supor.md_video.entity;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

public class VideoListBean implements Parcelable {

    private Integer total;
    private Integer page;
    private Integer limit;
    private Integer allpages;
    private List<VideoItemInfoBean> rows;

    protected VideoListBean(Parcel in) {
        if (in.readByte() == 0) {
            total = null;
        } else {
            total = in.readInt();
        }
        if (in.readByte() == 0) {
            page = null;
        } else {
            page = in.readInt();
        }
        if (in.readByte() == 0) {
            limit = null;
        } else {
            limit = in.readInt();
        }
        if (in.readByte() == 0) {
            allpages = null;
        } else {
            allpages = in.readInt();
        }
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (total == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(total);
        }
        if (page == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(page);
        }
        if (limit == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(limit);
        }
        if (allpages == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(allpages);
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<VideoListBean> CREATOR = new Creator<VideoListBean>() {
        @Override
        public VideoListBean createFromParcel(Parcel in) {
            return new VideoListBean(in);
        }

        @Override
        public VideoListBean[] newArray(int size) {
            return new VideoListBean[size];
        }
    };

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getPage() {
        return null == page ? 0 : page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getLimit() {
        return limit;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }

    public Integer getAllpages() {
        return null == allpages ? 0 : allpages;
    }

    public void setAllpages(Integer allpages) {
        this.allpages = allpages;
    }

    public List<VideoItemInfoBean> getRows() {
        return rows;
    }

    public void setRows(List<VideoItemInfoBean> rows) {
        this.rows = rows;
    }

}
